<?php

App::uses('AppHelper', 'View/Helper');

/**
 * Application helper
 *
 * Add your application-wide methods in the class below, your helpers
 * will inherit them.
 *
 * @package       app.View.Helper
 */
class ProductsHelper extends AppHelper {
	public $helpers = array('Html');

/** 
 * getSeoLink
 */
	public function getSEOLink($product){
		$Category = new Category();
		if(isset($product['Category']) && $product['Category']){
			$realPath = $Category->getPath($product['Category'][0]['id'], array('id', 'slug'), -1);
			$url = "/";
			foreach($realPath as $p){
				$url .= $p['Category']['slug'] . "/";
			}
			$url .= $product['Product']['slug'];
		}else{
			//find category	
			//if not category
			$url = "#";
		}
		return $url;
	}
}
